package com.patttern.structural.decorator;

/**
 * @Author: root
 * @Date: 2018/11/22 10:11
 */
public interface ICar {
    void move();
}

class Car implements ICar {

    @Override
    public void move() {
        System.out.println("在陆地上跑");
    }
}

class SuperCar implements ICar {
    protected ICar iCar;

    public SuperCar(ICar iCar) {
        this.iCar = iCar;
    }

    @Override
    public void move() {
        iCar.move();
    }
}

class AutoCar extends SuperCar {
    public AutoCar(ICar iCar) {
        super(iCar);
    }

    @Override
    public void move() {
        super.move();
        autoMove();
    }

    private void autoMove() {
        System.out.println("auto move.............");
    }
}

class AICar extends SuperCar {
    public AICar(ICar iCar) {
        super(iCar);
    }

    @Override
    public void move() {
        super.move();
        aiMove();
    }

    private void aiMove() {
        System.out.println("智能.............");
    }
}

class FlyCar extends SuperCar {
    public FlyCar(ICar iCar) {
        super(iCar);
    }

    @Override
    public void move() {
        super.move();
        flyMove();
    }

    private void flyMove() {
        System.out.println("天上飞.............");
    }
}

class WaterCar extends SuperCar {
    public WaterCar(ICar iCar) {
        super(iCar);
    }

    @Override
    public void move() {
        super.move();
        waterMove();
    }

    private void waterMove() {
        System.out.println("水里游.............");
    }
}